import { mAxios, mAxiosSG, encodeURL } from "./axios.js";
import axios from "axios";

const getSecretKey = () => {
    return mAxios.get("users/getSecretKey");
};
const getDomains = () => {
    return mAxios.get("domains");
};
const verifyImage = () => {
    return mAxios.get('users/getImage')
}
const loginSbumit = (param) => {
    return mAxios.post("login", param, {
        headers: {
            "Content-Type": "application/x-www-form-urlencoded",
        },
    });
}
const getMenu = () => {
    return axios.get('/api/js/conf_cut.json')
}
const getWhoami = () => {
    return mAxios.get('users/whoami')
}
const getHomeInfo = () => {
    return mAxiosSG.post('user/getInfo',{cmdlist: [{cmd: 132419, ncmd: "UserInfo"}]},{
        headers: {
            "Content-Type": "application/json;charset=UTF-8",
            "X-Auth-Token": "59c9588f05bbb819",
            "Access-Control-Allow-Methods": "POST,GET,OPTIONS"
        },
    })
}

// 心跳
const getUserToken = () => {
    return mAxios.put('users/usertoken')
}
const getSysBaseInfo = () => {
    return mAxios.get('sysbaseinfo/curtime')
}
export {
    getDomains,
    getSecretKey,
    verifyImage,
    loginSbumit,
    getMenu,
    getWhoami,
    getUserToken,
    getHomeInfo,
    getSysBaseInfo
}